﻿<!--
    Author   JO Hyeong-Ryeol
    Since	2013.04.28

    This file is a part of the Nicenis project.
    https://nicenis.codeplex.com
    
    Copyright (C) 2013 JO Hyeong-Ryeol. All rights reserved.   
-->
<Window x:Class="NicenisTestGui.HoverTestWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:n="clr-namespace:Nicenis.Windows;assembly=Nicenis"
        Title="HoverTestWindow" Height="300" Width="300">

    <!-- The border to test Hover. -->
    <Border Margin="10" n:HoverBehavior.IsActivated="True">
        <Border.Style>
            <Style TargetType="Border">
                <Style.Triggers>
                    <!-- If the mouse is in this element, sets the background to green. -->
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Background" Value="Green" />
                    </Trigger>

                    <!-- If the mouse is hovering, sets the background to light green. -->
                    <Trigger Property="n:HoverBehavior.IsMouseHover" Value="True">
                        <Setter Property="Background" Value="LightGreen" />
                    </Trigger>
                </Style.Triggers>

                <Setter Property="Background" Value="LightGray" />
            </Style>
        </Border.Style>

        <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">
            <TextBlock.Style>
                <Style TargetType="TextBlock">
                    <Style.Triggers>
                        <!-- If the mouse is in this element, sets the background to green. -->
                        <DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Border}}" Value="True">
                            <Setter Property="Text" Value="The mouse is in this element." />
                        </DataTrigger>

                        <!-- If the mouse is hovering, sets the background to light green. -->
                        <DataTrigger Binding="{Binding (n:HoverBehavior.IsMouseHover), RelativeSource={RelativeSource AncestorType=Border}}" Value="True">
                            <Setter Property="Text" Value="The mouse is hovering." />
                        </DataTrigger>
                    </Style.Triggers>

                    <Setter Property="Text" Value="Hover the mouse." />
                </Style>
            </TextBlock.Style>
        </TextBlock>
    </Border>
</Window>
